package com.xu.commons.until;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import org.apache.commons.codec.binary.Hex;

public class PasswordProvider {

	
	public static String createPassWord(String  inputStr){
		return encodebyMD5(inputStr);
	}

	public static String encodebyMD5(String inputStr) {
		try {
			MessageDigest d=MessageDigest.getInstance("MD5");
			byte[]  inputbytes=inputStr.getBytes();
			d.update(inputbytes);
			 return new String(Hex.encodeHex(inputbytes)).toUpperCase();
		} catch (NoSuchAlgorithmException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return null;
	}
	
	public static void main(String[] args) {
		System.err.println("加密        后:" + createPassWord("123456"));
	}
}
